﻿using System;
using System.Collections.Generic;

namespace mmCore.Common
{
    public class ExceptionManager
    {
        private static readonly List<Tuple<DateTime, Exception>> _mExceptions = new List<Tuple<DateTime, Exception>>();

        public static event Action<Exception> OnException;

        public static List<Tuple<DateTime, Exception>> Exceptions
        {
            get { return _mExceptions; }
        }

        public static void ReportError(Exception exc)
        {
            if(OnException != null)
            {
                OnException(exc);
            }
            _mExceptions.Add(new Tuple<DateTime, Exception>(DateTime.Now, exc));
        }
    }
}
